#include <iostream>

using namespace std;

/*
14-3 Create a three-level hierarchy of classes with default constructors, along with destructors, both of which announce themselves to cout. Verify that for an object of the most derived type, all three constructors and destructors are automatically called. Explain the order in which the calls are made.
*/
class A {
public:
	A() {
		cout << "the constructor of class A is called." << endl;
	}
	
	~A() {
		cout << "the destructor of class A is called." << endl;
	}
};

class B: public A {
public:
	B() {
		cout << "the constructor of class B is called." << endl;
	}
	
	~B() {
		cout << "the destructor of class B is called." << endl;
	}

};

class C: public B {
public:
	C() {
		cout << "the constructor of class C is called." << endl;
	}
	
	~C() {
		cout << "the destructor of class C is called." << endl;
	}

};

int main(int argc, char *argv[]) {
	C c;
}